//
// Created by Administrator on 2022/1/29.
//

#include "Calculator.h"


int Calculator::getResult(string op) //根据传入的运算法完成2个成员数字的计算
{
    if ( "+" == op )
    {
        return m_Num1 + m_Num2;
    }
    else if ( "-" == op )
    {
        return m_Num1 - m_Num2;
    }
    else
    {
        return 0;
    }

}

int AbstractCalculator2::getResult2()
{
    return 0;
}


int AddCalculator::getResult2()        // 专门做加法
{
    return m_Num1 + m_Num2;
}

int SubCalculator::getResult2()        // 专门做-法
{
    return m_Num1 - m_Num2;
}
